<template>
	<div class="adm3">
		<div class="box">
			<h4>热点管理</h4>
			<el-button size="mini" type="danger" @click="add()" style="float: right;">添加新的轮播图</el-button>
			<el-container>
				<el-main>
					<el-table ref='checkall' :data='adm3List' style='width: 90%;'>
						<el-table-column prop='memo' label='描述'></el-table-column>
						<el-table-column prop='hot' label='热度'></el-table-column>
						<el-table-column prop='type' label='类型'></el-table-column>
						<el-table-column  label='图片' v-slot="scope">
							<el-image :src="`${$Imgurl}/api/public/showImg/${scope.row.picture}`" width="90" height="90" />
						</el-table-column>
						<el-table-column prop='btn' label='操作'>
							<template v-slot="scope">
								<el-button size="mini" @click="del(scope.row.id)" style="background-color: #e6a23c;">X 删除</el-button>
							</template>
						</el-table-column>
					</el-table>
				</el-main>
			</el-container>
		</div>
	</div>
</template>

<script>
	export default{
		name:'Adm3',
		data(){
			return{
				adm3List:[],  //接收请求来的数据
				checkall:[],	//整个表单的数据对象
			}
		},
		methods:{
			add(){
				this.$router.push('/adm/admadd')
			},
			del(x){
					this.axios.delete('/api/adm/hot/delete/' + x).then((res)=>{
						this.arr()
					}).catch((error)=>{
						console.log(error)
					})
					console.log(x)
			},
			arr(){
				//发起异步请求
				this.axios.get('/api/adm/hot/findAll').then((res)=>{
					//判断状态
					if(res.status === 200){
						//向表格渲染数据
							this.adm3List = res.data.data
					}
				}).catch((error)=>{
					console.log(error)
				})
			}
		},
		created() {
			this.arr()
		}
	}
</script>

<style scoped>
.box h4{
	text-indent: 1em;
	font-size: 30px;
	color: aqua;
	font-weight: bold;
}
.adm3 button{
	cursor: pointer;
}
.tab tr img{
	height: 30px;
}
.box p:first-child{
	font-size: 30px;
	color:aqua ;
	font-weight: bold;
	padding-bottom: 20px;
	padding-right: 25px;
}
.tab{
	width: 70%;
	height: 100%;
	text-align: center;
}
</style>
